function result = harmonic_func(choice,M,t)
result = zeros(1,length(t));
harmonic_H{1} = [1,0.798,0.582,0.585,0.158,0.371,0.996,0.075,0.025,0.268,0.212,0.0207,0.0544,0.0158,0.0845]; % piano
harmonic_H{2} = [1,0.552,0.390,0.0298,0.0651,0.0231,0.00977,0.0288,0.0350,0.0232]; %guitar
harmonic_H{3} = [1,0.8065,0.25307,0.19266,0.29723,0.04152,0.1540]; %sachs
harmonic_H{4} = [1,0.8038,0.662,0.982,0.6113,0.8538,0.4031,0.3271,0.09745,0.1518,0.0890,0.0737,0.0531,0.0594,0.0323]; % brass
harmonic_H{5} = [1,0.5866,0.5682,0.1952,0.1756,0.1203,0.2167,0.0646,0.0908,0.0894]; % string
harmonic_H{6} = [1,0.4087,0.2140,0.2299,0.2668,0.0477,0.1299];  %violin
switch choice
    case 2
        for k=1:length(harmonic_H{1})
            result = result+harmonic_H{1}(k)*cos(2*pi*k*M*t);
        end    
    case 4
        for k=1:length(harmonic_H{2})
            result = result+harmonic_H{2}(k)*cos(2*pi*k*M*t);
        end    
    case 5
        for k=1:length(harmonic_H{3})
            result = result+harmonic_H{3}(k)*cos(2*pi*k*M*t);
        end    
    case 1
        for k=1:length(harmonic_H{4})
            result = result+harmonic_H{4}(k)*cos(2*pi*k*M*t);
        end    
    case 6
        for k=1:length(harmonic_H{5})
            result = result+harmonic_H{5}(k)*cos(2*pi*k*M*t);
        end    
    case 3
        for k=1:length(harmonic_H{6})
            result = result+harmonic_H{6}(k)*cos(2*pi*k*M*t);
        end    
    otherwise
        result = cos(2*pi*M*t);
end

